<template>
    <view
        @tap="__e"
        @touchmove.stop.prevent="__e"
        class="mask data-v-05a9aa05"
        :data-event-opts="[
            ['tap', [['cancel', ['$event']]]],
            ['touchmove', [['', ['$event']]]]
        ]"
    >
        <view @tap.stop.prevent="__e" class="mask-content data-v-05a9aa05" :data-event-opts="[['tap', [['', ['$event']]]]]">
            <text @tap="__e" class="new-iconfont icon-close close-btn data-v-05a9aa05" :data-event-opts="[['tap', [['cancel', ['$event']]]]]"></text>
            <view class="title data-v-05a9aa05">绑定手机号</view>
            <view class="phone-input-c data-v-05a9aa05">
                <view class="key data-v-05a9aa05">+86</view>
                <input
                    @input="__e"
                    class="data-v-05a9aa05"
                    :data-event-opts="[['input', [['__set_model', ['', 'phone', '$event', []]]]]]"
                    placeholder="输入手机号"
                    :value="phone"
                />
            </view>
            <view class="code-input-c data-v-05a9aa05">
                <input @input="__e" class="data-v-05a9aa05" :data-event-opts="[['input', [['__set_model', ['', 'code', '$event', []]]]]]" placeholder="输入验证码" :value="code" />
                <view @tap="__e" class="get-code-btn data-v-05a9aa05" :data-event-opts="[['tap', [['getCode', ['$event']]]]]" hoverClass="hover">{{ getCodeText }}</view>
            </view>
            <view class="button-2c data-v-05a9aa05">
                <view @tap="__e" :class="['button', 'submit', 'data-v-05a9aa05', !isCanSubmit ? 'disabled' : '']" :data-event-opts="[['tap', [['submit', ['$event']]]]]">
                    <text class="data-v-05a9aa05">确认绑定</text>
                </view>
            </view>
        </view>
    </view>
</template>

<script>
import tabBar from '@/components/TabBar/tabBar';
(global.webpackJsonp = global.webpackJsonp || []).push([
    ['components/GetPhonePopup/GetPhonePopup'],
    {
        '18ca': function (n, e, t) {
            'use strict';

            t.d(e, 'b', function () {
                return o;
            });
            t.d(e, 'c', function () {
                return c;
            });
            t.d(e, 'a', function () {});
            var o = function () {
                this.$createElement;
                this._self._c;
            };
            var c = [];
        },
        '3e5b': function (n, e, t) {},
        7624: function (n, e, t) {
            'use strict';

            (function (n) {
                Object.defineProperty(e, '__esModule', {
                    value: true
                });
                e.default = void 0;
                var t = {
                    components: {},
                    data: function () {
                        return {
                            phone: '',
                            code: '',
                            clock: 0
                        };
                    },
                    props: {},
                    computed: {
                        isPhonePass: function () {
                            return 11 === this.phone.length;
                        },
                        isCanSubmit: function () {
                            return this.isPhonePass && 6 === this.code.length;
                        },
                        getCodeText: function () {
                            return this.clock <= 0 ? '验证码' : this.clock + 's';
                        }
                    },
                    watch: {},
                    onLoad: function (n) {},
                    created: function () {},
                    methods: {
                        cancel: function () {
                            this.$emit('cancel');
                        },
                        submit: function () {
                            if (!this.isCanSubmit) {
                                n.showModal({
                                    title: '',
                                    content: '请填写正确手机号及6位验证码',
                                    icon: 'none'
                                });
                                return false;
                            }
                            this.$emit('success', {
                                phone: this.phone,
                                phone_code: this.code
                            });
                        },
                        getCode: function () {
                            var that = this;
                            return (
                                !(this.clock > 0) &&
                                (this.isPhonePass
                                    ? (n.showLoading({
                                          title: '请求中',
                                          mask: false
                                      }),
                                      void this.$http('/login/phone-code', 'POST', {
                                          phone: this.phone
                                      }).then(function (t) {
                                          n.hideLoading();
                                          that.clock = 60;
                                          that.refreshClock();
                                      }))
                                    : (n.showModal({
                                          title: '',
                                          content: '手机号不正确',
                                          icon: 'none'
                                      }),
                                      false))
                            );
                        },
                        refreshClock: function () {
                            var that = this;
                            setTimeout(function (e) {
                                that.clock--;
                                if (that.clock > 0) {
                                    that.refreshClock();
                                }
                            }, 1000);
                        }
                    },
                    onPageScroll: function (n) {}
                };
                e.default = t;
            }.call(this, t('543d').default));
        },
        b849: function (n, e, t) {
            'use strict';

            var o = t('3e5b');
            t.n(o).a;
        },
        e18e: function (n, e, t) {
            'use strict';

            t.r(e);
            var o = t('7624');
            var c = t.n(o);
            for (var i in o) {
                if (['default'].indexOf(i) < 0) {
                    (function (n) {
                        t.d(e, n, function () {
                            return o[n];
                        });
                    })(i);
                }
            }
            e.default = c.a;
        },
        fc3f: function (n, e, t) {
            'use strict';

            t.r(e);
            var o = t('18ca');
            var c = t('e18e');
            for (var i in c) {
                if (['default'].indexOf(i) < 0) {
                    (function (n) {
                        t.d(e, n, function () {
                            return c[n];
                        });
                    })(i);
                }
            }
            t('b849');
            var u = t('f0c5');
            var s = Object(u.a)(c.default, o.b, o.c, false, null, '05a9aa05', null, false, o.a, void 0);
            e.default = s.exports;
        }
    }
]);
(global.webpackJsonp = global.webpackJsonp || []).push([
    'components/GetPhonePopup/GetPhonePopup-create-component',
    {
        'components/GetPhonePopup/GetPhonePopup-create-component': function (n, e, t) {
            t('543d').createComponent(t('fc3f'));
        }
    },
    [['components/GetPhonePopup/GetPhonePopup-create-component']]
]);
</script>
<style>
@import './GetPhonePopup.css';
</style>
